package com.sf.leetcode.primary_alogrithm;

class Res{
    private Integer count = 0;
    public Integer getNumber(){
        return ++count;
    }
}
public class test02 extends Thread{
    private Res res;
    public test02(Res res){
        this.res = res;
    }
    @Override
    public void run() {
        for (int i = 0; i < 3; i++) {
            System.out.println(Thread.currentThread().getName()+","+res.getNumber());
        }
    }

    public static void main(String[] args) {
        Res res = new Res();
        test02 t1 = new test02(res);
        test02 t2 = new test02(res);
        t1.start();
        t2.start();
    }
}
